hysop.operator.poisson_curl module¶
@file poisson.py PoissonCurl solver frontend.
- class hysop.operator.poisson_curl.PoissonCurl(velocity, vorticity, variables, implementation=None, base_kwds=None, **kwds)[source]¶
Bases:
SpectralComputationalGraphNodeFrontend
Interface the poisson solver. Available implementations are:
FORTRAN (fftw based solver)
PYTHON (gpyfft based solver)
OPENCL (clfft based solver)
Initialize a PoissonCurl operator frontend for 2D or 3D streamfunction-vorticity formulations.
in = W (vorticity) out = U (velocity)
Vorticity also becomes an output if projection or diffusion is enabled.
- PoissonCurl does more than just solving the Poisson equation for velocity:
a/ diffusion of W | optional step (enabled with diffusion and dt)
b/ projection of W (such that div(U)=0) | optional step (enabled with projection)
c/ poisson solver to recover U from W
- About dimensions:
if velocity is a 2D vector field, vorticity should have only one component Wx.
if velocity is a 3D vector field, vortcitiy should have three components (Wx,Wy,Wz).
In 2D:
laplacian(psi) = -W Ux = +dpsi/dy Uy = -dpsi/dx
In 3D:
laplacian(psi) = -W U = rot(psi)
- Parameters:
velocity (Field) – output continuous velocity field (all components)
vorticity (Field) – input continuous vorticity field (all components)
variables (dict) – dictionary of fields as keys and topologies as values.
diffusion (ScalarParameter, optional, defaults to None.) – Diffuse the vorticity field before applying projection and poisson operators. If diffusion is specified, a timestep has to be specified.
dt (ScalarParameter, optional, defaults to None) – Timestep is only required for diffusion. If diffusion is not enabled, this parameter is ignored.
projection (hysop.constants.FieldProjection or positive integer, optional) – Project vorticity such that resolved velocity is divergence free (for 3D fields). When active, projection is done prior to every solve, unless projection is an integer in which case it is done every given steps. This parameter is ignored for 2D fields and defaults to no projection.
implementation (Implementation, optional, defaults to None) – target implementation, should be contained in available_implementations(). If None, implementation will be set to default_implementation().
base_kwds (dict, optional, defaults to None) – Base class keywords arguments. If None, an empty dict will be passed.
kwds – Keywords arguments that will be passed towards implementation poisson operator __init__.
Notes
A PoissonCurl operator implementation should at least support the following __init__ attributes: velocity, vorticity, variables